<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

	
    <title>权限管理</title>

<%@ include file="/page/include.jsp" %>
    <!-- Bootstrap -->
    <link href="../statics/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="../statics/css/font-awesome.min.css" rel="stylesheet"> 
    <!-- iCheck -->
    <link href="../statics/plugins/iCheck/skins/flat/green.css" rel="stylesheet"> 
    <!-- Select2 -->
    <link href="../statics/plugins/select2/css/select2.min.css" rel="stylesheet"> 
	<!-- Switchery -->
    <link href="../statics/plugins/switchery/switchery.min.css" rel="stylesheet">

    <!-- Custom Theme Style -->
    <link href="../statics/css/custom.css" rel="stylesheet">
  </head>

  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
       

        <!-- page content -->
        <div class="framebody" role="main">
          <div class="">
            <div class="page-title">
              <div class="title_left">
                <h3>设置用户 <strong>${user.userCode}/${user.userName}</strong> 的可用角色</h3>
              </div>
 
            </div>
            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-6 col-xs-12">
                <div class="x_panel">
                  <div class="x_content">
                    <br />
                    <form class="form-horizontal form-label-left">
                      </div>
                      <div class="form-group">
                        <div class="col-md-9 col-sm-9 col-xs-12">
                        <input type="hidden" id="userId" name="userId" value="${user.id}">
                        <c:forEach var="role" items="${roleList}">
	                        <div >
	                            <label>
	                              <input type="checkbox" class="flat" name="role" value="${role.id}" ${role.chkFlag == '1' ? 'checked="checked"' : ''} > ${role.roleName}
	                            </label>
	                         </div>
						</c:forEach>
                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                             <a id="btn_back"class="btn btn-inverse"><i class="fa fa-reply fa-fw"></i>返回</a>
                             <a id="btn_save" class="btn btn-primary"><i class="fa fa-check fa-fw"></i>确定</a>
                        </div>

                    </form>
                  </div>
                </div>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
              </div>


             
            </div>

            
 
          </div>
        </div>
        <!-- /page content -->
 
      </div>
    </div>

    <!-- jQuery -->
    <script src="../statics/js/jquery.1.11.3.min.js"></script>
    <!-- Bootstrap -->
    <script src="../statics/js/bootstrap.min.js"></script>    
	<!-- iCheck -->
    <script src="../statics/plugins/iCheck/icheck.min.js"></script>   
	<!-- Select2 -->
    <script src="../statics/plugins/select2/js/select2.full.min.js"></script>
	<!-- Switchery -->
    <script src="../statics/plugins/switchery/switchery.min.js"></script>
	
    <!-- Custom Theme Scripts -->
    <script src="../statics/js/custom.js"></script>
	<script type="text/javascript"  src="${rootPath }/js/auth/user/user_role_settings.js"></script>
	<script>
		
		$(document).ready(function() {
			// iCheck
			if ($("input.flat")[0]) {
				$('input.flat').iCheck({
					checkboxClass: 'icheckbox_flat-green',
					radioClass: 'iradio_flat-green'
				});
			}
			//select2
			init_select2();
			// Switchery
			if ($(".js-switch")[0]) {
				var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
				elems.forEach(function (html) {
					var switchery = new Switchery(html, {
						color: '#26B99A'
					});
				});
			}
		});
	  
		/* SELECT2 */
	  
		function init_select2() {
			 
			if( typeof (select2) === 'undefined'){ return; }
			console.log('init_toolbox');
			 
			$(".select2_single").select2({
			  placeholder: "Select a state",
			  allowClear: true
			});
			$(".select2_group").select2({});
			$(".select2_multiple").select2({
			  maximumSelectionLength: 4,
			  placeholder: "With Max Selection limit 4",
			  allowClear: true
			});
			
		};
	</script>
  </body>
</html>
